<template>
  <div class="ceiling" :class="{ show: top > 80 }">
    <div class="xin" v-show="top > 80">
      <img src="@/assets/img/login.png" />
      <div class="commin">
        <common></common>
      </div>

      <ul class="ul2">
        <li style="color: #27ba9b">|</li>
        <li>品牌</li> 
        <li>专题</li>
      </ul>
    </div>
  </div>
</template>

<script>
import common from "./CommonText.vue";
// import { throttle } from "@/utils/constfun";
import _ from "lodash";
export default {
  components: { common },
  data() {
    return {
      top: 0,
    };
  },
  mounted() {
`    // window.addEventListener("scroll", throttle(this.setup));`
    window.addEventListener("scroll", _.throttle(this.setup, 200));
  },
  methods: {
    setup() {
      this.top = document.documentElement.scrollTop;
      // console.log(this.top);
    },
  },
};
</script>

<style lang="scss" scoped>
.ceiling {
  width: 100%;
  background-color: rgb(255, 255, 255);
  height: 80px;
  transform: translateY(-100%);
  opacity: 0;
  position: fixed;
  z-index: 999;
  .xin {
    width: 1240px;
    height: 80px;
    display: flex;
    margin: auto;
    img {
      width: 200px;
      height: 80px;
    }
    .ul2 {
      display: flex;
      justify-content: space-around;
      height: 80px;
      width: 200px;
      li {
        width: 32px;
        height: 80px;
        line-height: 80px;
        text-align: center;
      }
      &:nth-child(2){
        margin: 0 5px 0 0;
      }
    }
  }
  &.show {
    transform: translateY(0);
    opacity: 1;
    background-color: #fff;
    transition: all 0.1 0.1 linear;
  }
  .commin {
    margin-top: 24px;
  }
 
}
</style>
